//
//  UtilsMacros.h
//
//

#ifndef UtilsMacros_h
#define UtilsMacros_h


//=============== 网络相关 ==================
//#define BaseUrl @"https://admin.boxingkeji.com/api/"

//=============== 颜色相关 ==================
#define RGBA(r,g,b,a) [UIColor colorWithRed:r/255.0f green:g/255.0f blue:b/255.0f alpha:a]
#define RGB(r,g,b) RGBA(r,g,b,1.0f)
#define rgba(r,g,b,a) [UIColor colorWithRed:r/255.0f green:g/255.0f blue:b/255.0f alpha:a]
#define ColorAppMainBlack RGB(23, 23, 28)
#define ColorAppMainLightBlack RGB(40, 40, 56)
#define ColorAppMain RGB(255, 94, 96)


//=============== 机型相关 ==================
/** 判断是否为iPhone*/
#define kISiPhone   (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone)
/** 判断是否为iPad*/
#define kISiPad     (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)


#define  KScreen_W             ([UIScreen mainScreen].bounds.size.width)
#define  KScreen_H             ([UIScreen mainScreen].bounds.size.height)
#define  kStatusBarHeight      [[UIApplication sharedApplication] statusBarFrame].size.height

//状态栏高度
#define  KBaseNavi_Height      44
#define  KSafeAreaBottomHeight [UIApplication sharedApplication].keyWindow.safeAreaInsets.bottom// 底部安全区域距离
#define  KNav_H                (kStatusBarHeight+KBaseNavi_Height)
#define  KTab_TABH             [[UITabBarController alloc] init].tabBar.frame.size.height
#define  KTab_H                (KTab_TABH+KSafeAreaBottomHeight)

#define  KDif_H                (kStatusBarHeight - 24)
#define  GETPIXEL              (KScreen_W / 375) //按375屏宽设置 获取像素比
#define  K_AUTOLAYOUT_W(with) (with * GETPIXEL)

#define  GETPIXEL1              (KScreen_W / 667) //按375屏宽设置 获取像素比
#define  K_AUTOLAYOUT_W1(with) (with * GETPIXEL1)
//=============== image ==================
#define KImageNamed(name)    [UIImage imageNamed:(name)]
#define KImageUrl(url)       [url hasPrefix:@"http"] ? [NSURL URLWithString:url]:[NSURL URLWithString:url relativeToURL:[NSURL URLWithString:QiNiuBaseUrl]]
#define KImageUrlString(url) [url hasPrefix:@"http"] ? url:[NSString stringWithFormat:@"%@%@",QiNiuBaseUrl,url]

//=============== 便捷方法 ==================

#define KWeakSelf   __weak typeof(self) weakSelf = self;
#define KStrongSelf   __strong typeof(self) strongSelf = weakSelf;//只能修饰weakSelf 用来为了防止弱引用内存提前释放

#define ShowHud(String)  [SVProgressHUDTool showToastMessage:String];

#define ShowCYLoading [CYLoadingView show];
#define ShowCYWithTip(String) [CYLoadingView showWithTip:String];
#define HideCYLoading [CYLoadingView hide];
#define CYParamsInit(paramsConfigs) NSMutableDictionary *paramsConfigs = [NSMutableDictionary dictionary];
#define CYIMAGENAME(imageName) [UIImage imageNamed:imageName]
#define CYIMAGENAMEWITHORIGINAL(imageName) [[UIImage imageNamed:imageName] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal]
#define CYURLString(string) [NSURL URLWithString:string]

// UILabel 初始化
#define UILABEL_ALLOC(X,Y,x,y) [[UILabel alloc] initWithFrame:CGRectMake(X,Y,x,y)]
// UITextField 初始化
#define UITEXTFIELD_ALLOC(X,Y,x,y) [[UITextField alloc] initWithFrame:CGRectMake(X,Y,x,y)]
// UIView 初始化
#define UIVIEW_ALLOC(X,Y,x,y) [[UIView alloc] initWithFrame:CGRectMake(X,Y,x,y)]
// UIImageView 初始化
#define UIIMAGEVIEW_ALLOC(X,Y,x,y) [[UIImageView alloc] initWithFrame:CGRectMake(X,Y,x,y)]

#define APPVersion [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleShortVersionString"]



#ifdef DEBUG
#define NSLog(...) NSLog(__VA_ARGS__)
#define debugMethod() NSLog(@"%s", __func__)
#else
#define NSLog(...)
#define debugMethod()
#endif



#endif /* UtilsMacros_h */
